home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 / Aminet - June 1993 [Walnut Creek].iso / usenet / sources / volume90 / util / deadaloc / part01
Encoding:
Internet Message Format  |  1990-10-08  |  32.9 KB

  1. Path: abcfd20.larc.nasa.gov!amiga-request
  2. From: amiga-request@abcfd20.larc.nasa.gov (Amiga Sources/Binaries Moderator)
  3. Subject: v90i268: deadalloc 1.23 - allocate ``dead tracks'', Part01/01
  4. Reply-To: ins425v@monu4.cc.monash.edu.au (mr  t.h. mackenzie)
  5. Newsgroups: comp.sources.amiga
  6. Message-ID: <comp.sources.amiga:v90i268@abcfd20.larc.nasa.gov>
  7. Date: 08 Oct 90 23:47:35 GMT
  8. Approved: tadguy@uunet.UU.NET (Tad Guy)
  9. X-Mail-Submissions-To: amiga@uunet.uu.net
  10. X-Post-Discussions-To: comp.sys.amiga
  11.  
  12. Submitted-by: ins425v@monu4.cc.monash.edu.au (mr  t.h. mackenzie)
  13. Posting-number: Volume 90, Issue 268
  14. Archive-name: util/deadalloc-1.23/part01
  15.  
  16. [ uuencoded executable enclosed  ...tad ]
  17.  
  18. This is a program which allocates dead tracks on amiga OFS floppys and
  19. creates a file to stop their deallocation.  Source/Docs/Binaries included.
  20. Compiles under DICE.  This is my origional work. 
  21.  
  22.  
  23. #!/bin/sh
  24. # This is a shell archive.  Remove anything before this line, then unpack
  25. # it by saving it into a file and typing "sh file".  To overwrite existing
  26. # files, type "sh file -c".  You can also feed this as standard input via
  27. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  28. # will see the following message at the end:
  29. #        "End of archive 1 (of 1)."
  30. # Contents:  DeadAlloc.doc DeadAlloc.uu Deadalloc.c
  31. # Wrapped by tadguy@abcfd20 on Mon Oct  8 19:47:33 1990
  32. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  33. if test -f 'DeadAlloc.doc' -a "${1}" != "-c" ; then 
  34.   echo shar: Will not clobber existing file \"'DeadAlloc.doc'\"
  35. else
  36. echo shar: Extracting \"'DeadAlloc.doc'\" \(2948 characters\)
  37. sed "s/^X//" >'DeadAlloc.doc' <<'END_OF_FILE'
  38. X
  39. XDeadAlloc - A program for allocating dead tracks on AmigaDos [OFS] floppys.
  40. X
  41. X(c) Tim MacKenzie.
  42. X13/8/90.
  43. X
  44. X---------------------------------------------------------------------
  45. XThis program may be freely redistributed and modified as long as this 
  46. Xcopyright message remains intact and such activity is not for profit.
  47. XThe author (thats me) takes no responsibility for any damage/loss/&c
  48. Xresulting from the use/misuse of this program.
  49. X----------------------------------------------------------------------
  50. X
  51. X
  52. XEveryone (well nearly) has a few disks which have a few dead tracks on them
  53. Xmaking them (the disks) quite useless to AmigaDos when you try to write 
  54. Xto them.  IbM owners dont worry about this as their OS kindly allocates
  55. Xthese tracks and continues on it's merry way (It's only a simple minded
  56. Xsystem so it's allowed to be _merry_).  AmigaDos is not quite so kind, 
  57. Xso here is this program to do the allocation for you.
  58. X
  59. XThis program creates a file "...dead" which contains all of the 
  60. Xdead/unusable tracks on a floppy.  This allows the floppy to be used 
  61. Xnormally for data, programs etc.  The program does not recover tracks, 
  62. Xit just tells the file system that they are allocated and are hence not
  63. Xused for 'useful' data.  Creation of the file "...dead" stops the tracks
  64. Xbeing deallocated when the disk is re-validated after a crash &c.
  65. X
  66. XTo use:
  67. X    DeadAlloc [df?:] [-n] [-m]
  68. X
  69. X    :- df? selects the drive to operate on. [default is df1:]
  70. X    :- -m stops the program from creating the file.
  71. X    :- -n allows the program to doubly allocate tracks. ie. It will 
  72. X            reallocate tracks (This is not a good idea)
  73. X
  74. X    DeadAlloc ? 
  75. X        Will display the options.
  76. X
  77. XNotes:
  78. X    1: It is a good idea to use the program on empty disks. This prevents
  79. X        the situation of reallocating a block which belongs to an
  80. X        existing file.
  81. X    2: The file created has no delete privaliges. To delete it you must 
  82. X        change it's protection with 'protect ...Dead +d'
  83. X    3: The program will exit if a '...Dead' file already exists.
  84. X    4: If you reallocate blocks then delete both files which have a claim
  85. X        to that block then you will receive a 'Disk corrupt' message.
  86. X    5: Sometimes the disk checker will not pick up a dead track. In this 
  87. X        case you should delete the '...Dead' file and retry.
  88. X    6: The source compiles with DICE. Manx/Lattice users need to change
  89. X        the #includes and include Open/Close Library routines
  90. X        !!thanx Matt!!.
  91. X    7: A disk with tracks 40 or 0 dead may be unrecoverable/unuseable.
  92. X    8: If you use the program on disks with existing files and it informs
  93. X        you that a block is already allocated then no file will be
  94. X        created and no blocks allocated.  You must remove the
  95. X        offending file and retry.
  96. X
  97. X
  98. XMy Address.
  99. X    Tim MacKenzie.
  100. X    36 Alexander Ave
  101. X    Upwey, Victoria.
  102. X    AUSTRALIA. 3158.
  103. X
  104. XInternet: ins425v@monu4.cc.monash.edu.au  (til Nov '90)
  105. X          ins425v@monu3.cc.monash.edu.au  ( ----"----)
  106. X
  107. XAny Donations, suggestions, thanx, Fan mail, flames etc are most welcome :-}
  108. END_OF_FILE
  109. if test 2948 -ne `wc -c <'DeadAlloc.doc'`; then
  110.     echo shar: \"'DeadAlloc.doc'\" unpacked with wrong size!
  111. fi
  112. # end of 'DeadAlloc.doc'
  113. fi
  114. if test -f 'DeadAlloc.uu' -a "${1}" != "-c" ; then 
  115.   echo shar: Will not clobber existing file \"'DeadAlloc.uu'\"
  116. else
  117. echo shar: Extracting \"'DeadAlloc.uu'\" \(15756 characters\)
  118. sed "s/^X//" >'DeadAlloc.uu' <<'END_OF_FILE'
  119. Xbegin 666 DeadAlloc
  120. XM```#\P`````````"``````````$```EW```"40```^D```EW2.<_/BQY````)
  121. XM!"1/+P@O`#`\``!G5"`\```!`-"\```!4>6`4(`J`"(\``$``$ZN_SI*@&8(J
  122. XM+DIP_V```,8@0$*8(,5)Z'_^1^C_^$/Y`````"`\```!46`"(-E1R/_\D+P`E
  123. XM`0``9/)@#$GY`````$GL?_Z7RT'L@`(@/````5'E@-'`(#P```$`<@!@`B#!^
  124. XM4<C__)"\``$``&3R*4N%3BE*A4IP`"(\```0`$ZN_LXI3H5&3KD``"/<3KD`U
  125. XM`"/X3KH+0DAY`````$AY`````"QLA49.N0``)`Q.N0``(_PJ;(5*("R%3F<2O
  126. XM)$`F4B`J``0B2DZN_RX@"V;N("\`!"Y-3-]\_$YU3E4``$ALA3E.N@\:6(](G
  127. XM>```3KH`TEB/2'@"`"\LAIQ.NB.Z4(](;(9L3KHD=%B/2&R&2DZZ(_I8CTAXY
  128. XM``!.N@I,6(].74YU3G5.50``2'@``DAX`@!.NB-L4(\I0(:<2JR&G&8.2&R%C
  129. XM!$ZZ#KA8CTZZ"AI(>```3KHC>EB/*4"&1BELAD:&6DALADI.NB..6(](>```+
  130. XM2&R&;!`L@"9(@$C`+P!(;(3S3KHCUD_O`!!*@&<22&R$QDALA-=.N@YF4(].Z
  131. XMN@G(0>R&2BE(AGHY?``"AH@I;(:<AI0I?````@"&D$Y=3G4O`DY5```Y?``"%
  132. XMAH@I?````@"&D"`M``QR">.@*4"&F"ELAIR&E$ALAFQ.NB.B6(\D`#E\``F&\
  133. XMB'``*4"&D$ALAFQ.NB.*6(\@`DY=)!].=2\"3E4``#E\``.&B"E\```"`(:0C
  134. XM("T`#'()XZ`I0(:8*6R&G(:42&R&;$ZZ(U)8CR0`.7P`"8:(<``I0(:02&R&2
  135. XM;$ZZ(SI8CR`"3ETD'TYU+P(D+P`(3E4``"`"D+P````4Y8!![(`JT<`O$"\"Y
  136. XM2&R#S4ZZ#7I/[P`,3ETD'TYU``!(YSP`3E4``#E\``*&B"E\```"`(:0>`!(>
  137. XM;(/(3KH-3EB/=`!@;B\"2&R#O4ZZ#3Y0CTAL@[I.N@TT6(]Z`&!*(@)P"TZZ&
  138. XM"PXB`"`!T(5R">.@*4"&F$ALAFQ.NB*@6(\F`$J#9R(O`DAL@Z].N@S^4(\O`
  139. XM`TZZ_UA8CT'LAJ#1PA"\``%2A&`*4H6ZO`````MMKE*"M+P```"@;8I(;(.KL
  140. XM3KH,REB/+P1(;(./3KH,OE"/.7P`"8:(>@`I18:02&R&;$ZZ(CA8CR`$3EU,#
  141. XMWP`\3G5.5?_T+RT`"$AL@V].N@R,4(\9?``!@"A.74YU2.<\,$Y5__@O+(=``
  142. XM3KK^,EB/*@!*A6<6+P5.NO[$6(](;(-#3KH,6%B/8``!,G0`8```OD'LAJ#10
  143. XMPDH09P``L'8`8```H"("<`M.N@H:(@`@`="\````(-"#*`!5A+B\````(&T`X
  144. XM`'PB!'`@3KH*5"(`(`'E@"!LAIS1P"1((@1P($ZZ"@8B`"`!<@'AH2`!P))F*
  145. XM""\$3KK_3%B/(@1P($ZZ"B`B`"`!Y8`D;(:<U<`B!'`@3KH*#"(`(`'E@"!L4
  146. XMAIS1P"9((@1P($ZZ";XB`"`!<@'AH2`!"H#_____))/!DE*#MKP````+;0#_-
  147. XM6E*"M+P```"@;0#_/"\LAIQ.N@!F6(\O+(=`3KK]AEB/*@!*A6=&2&R#*DZZ;
  148. XM"V18CR\%3KK]OEB/2&R#(DZZ"U)8CTALA91.N@R`6(](;?_[2&R#'TZZ#K90"
  149. XMCPPM`'G_^V<*#"T`6?_[9P)Z`$J%9J9.74S?##Q.=2\"(&\`"'``<@%@#"0!3
  150. XMY8)#\"@`T)%2@;*\````@&7L)`!$@B"")!].=2\"(&\`"'``<@!@%+*\````3
  151. XM!6<*)`'E@D/P*`#0D5*!LKP```"`9>0D`$2"(4(`%"0?3G5(YSXP3E4``"\L*
  152. XMAT!.NOQN6(\L`$J&9P9P`&```4@H/````W!@``$T*CP```;@FH1T'M2$=A[6,
  153. XMA2("<"!.N@C`(@`@`>6`(&R&G-'`)$@B`G`@3KH(<B(`(`%R`>&A(`'`DF=D(
  154. XM(@)P($ZZ")0B`"`!Y8`D;(:<U<`B`G`@3KH(@"(`(`'E@"!LAIS1P"9((@)PT
  155. XM($ZZ"#(B`"`!<@'AH2`!"H#_____))/!DB\LAIQ.NO[R6(\O+(=`3KK\$EB/&
  156. XM(`1@``"B8```DB(#<"!.N@@P(@`@`>6`)&R&G-7`(@-P($ZZ!^0B`"`!<@'A[
  157. XMH2`!P))G9K:\````'V]>(@-P($ZZ!_XB`"`!Y8`D;(:<U<`B`W`@3KH'ZB(``
  158. XM(`'E@"!LAIS1P"9((@-P($ZZ!YPB`"`!<@'AH2`!"H#_____))/!DB\LAIQ.'
  159. XMNOY<6(\O+(=`3KK[?%B/(`5@#%*$N+P```;@;0#^QDY=3-\,?$YU2.<_`$Y5G
  160. XM__@,+``!AJ!F!'P"8`)\`$ZZ_GPD`$J"9@Y(;(+V3KH)*%B/8``":G`"*4"'\
  161. XM1BE"ATIP!RE`B(9(;(+32&R(CDZZ%P90CTAL@LI(;(CV3KH6^%"/*7P```-P&
  162. XMB3IP_2E`B4)P`"M`__QV`&`Z(BW__'`+3KH'&"(`(`%![(:@T<!*$&<>("W_(
  163. XM_+"\`````FT2<$>0@^6`0>R'7M'`(*W__%*#4JW__`RM```&X/_\;`BVO```2
  164. XM`$AMM"`#D(8I0(=.(BT`('`+3KH&:"(`(`&0AB(`(#P```'H3KH&5BE`B(HI(
  165. XM;(AZAU9(>`-P3KKZ'EB/(&R&G"EH`/2)-B!LAIPA0@#T+RR&G$ZZ_5)8CTAXW
  166. XM`W!.NOI(6(]X`+:\````2&8<3KK];"@`2H1F#DAL@J%.N@@86(]@``%:*42)*
  167. XM/GH`8!@@!>6`(&R&G-'`(`7E@$/LAT;3P""14H6ZO````(!MX"\LAIQ.NOST2
  168. XM6(\O`DZZ^>Q8CV```1!^`'`0*4"'1G8`8"XB+?_\<`M.N@8"(@`@`4'LAJ#11
  169. XMP$H09Q)P1Y"#Y8!![(=>T<`@K?_\4H-2K?_\#*T```;@__QL"+:\````2&W`Q
  170. XM*@-@$G!'D(7E@$'LAU[1P'``((!2A;J\````2&WF*4.'3G``*4")-GH`8`Q!K
  171. XM[(B.T<40O```4H6ZO````%QM['H`8`Q![(CVT<40O```4H6ZO````$!M['``O
  172. XM*4"(AG``*4"(BBE"B3HI1(=*<``I0(=6<``I0(D^MKP```!(9@I.NOQ*+@`IS
  173. XM1XD^>@!@&"`%Y8`@;(:<T<`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P,OS
  205. XM!'8`>``D`%*#XX)E!+2!8_;BDE.#DH('Q%.#90CBBK2!8_)@]"`$*!\F'R0?P
  206. XM3G4@;P`$<`!@`E*(#!``(&?X#!``"6?R2A!G2`P0``IF`F!`4H`,$``B9A)2L
  207. XMB$H09R(,$``B9O1@&F`"4HA*$&<2#!``"F<,#!``(&<&#!``"6;H2A!F`F`*M
  208. XM(DA2B!*\``!@J$YU+PH@;P`((F\`#"`O`!!@*F`"4H@,$``@9_@,$``)9_(,4
  209. XM$``B9@)2B"1)6(DDB&`"4HA*$&;Z4HA3@$J`9M8D7TYU3G%(YR`@)"\`#$Y5-
  210. XM``!*@F8$<`!@-$AX``%P"-""+P!.NA4(4(\D0"`*9Q8DK(5.*4J%3G`(T((E;
  211. XM0``$1>H`"&`&<`4I0(8^(`I.74S?!`1.=2!O``0B;P`(("\`#&<&$MA3@&;Z?
  212. XM("\`"$YU$B\`#V`"<@`@;P`$("\`"&<&$,%3@&;Z("\`!$YU2.<@($Y5``!%&
  213. XM[0`42&R%E$AZ`F8O"B\M`!!.N@.X3^\`$"0`(`).74S?!`1.=4YQ2.<@("1O6
  214. XM``Q.50``=/\@"F=$""H````F9SPO"DZZ`$)8CR0`2JH`-F<*+RH`-DZZ$`A8B
  215. XMCP@J``<`)V8:(&H`!""22I)G""!2(6H`!``$+PI.N@_F6(\@`DY=3-\$!$YU?
  216. XM2.<P("1O`!!.50``)BH`&):J`"!*J@`@;29*J@`09R!*@V<<+P,O*@`0+RH`#
  217. XM,$ZZ#Q1/[P`,MH!G!G#_)4``*"0J`"@(*@`!`"9G+$JJ``AG$"\J``A.N@^`1
  218. XM6(]P`"5```A*J@`09Q`O*@`03KH/:EB/<``E0``0+RH`,$ZZ#3I8CP@J``4`K
  219. XM)V<*+RH`-DZZ$TA8CP*J___^\P`D(`).74S?!`Q.=4YQ2.<P("1O`!!.50``_
  220. XM=@!.NN_<(`IG``#,""H````F9P``PC5\__\`-$JJ`!AG+$JJ`!!F)B\J`!A.X
  221. XMNOX&6(\E0``0".H``0`F2JH`$&8&<``E0``8)6H`&``@2JH`'&TR""H`!``FB
  222. XM9RI*J@`<;QY(>```("H`+)"J`!PO`"\J`#!.N@V23^\`#"5``"QP_R5``!Q*N
  223. XMJ@`@;3(D*@`8E*H`($J"9R8O`B\J`!`O*@`P3KH-[$_O``RT@&<&</\E0``H1
  224. XMU:H`+"5J`!@`($JJ`"!L#$JJ`!AG!B5J`!@`("5J`!``%"`#3EU,WP0,3G4OL
  225. XM"B1O``A.50``-7S__P`T)6T`$``P,BT`%C`\`0"`04C`)4``)"5\```$```8N
  226. XM</\E0``@</\E0``<+RH`,$ZZ#)!8CTJ`9P8(Z@`$`"=.721?3G5(YSXP)&\`M
  227. XM("0O`"0F+P`H)F\`+$Y5``!X_[2\`````68$*@-@&+:\`````68$*@)@#"`#'
  228. XM(@+!04ZZ^S8J`"`+9P``D`@K``,`)V<``(:ZJP`@;P@O"TZZ_FA8C[JK`"!NS
  229. XM1"\%+RL`%"\*3KH-V$_O``R;JP`@(&L`%-'%)T@`%"@%""L`!``G9TA*A6=$H
  230. XM(`53@$'R"``,$``*9C8O"TZZ_B!8CV`L+`5@)"\&+PHO*P`P3KH,J$_O``PHC
  231. XM`$J$;@)@$-FK`"Q!\D@`1="<A$J&;MA*A&P&?/\G1@`H2JL`*&<&("L`*&`4E
  232. XMNH1F!"`#8`PB!"`"3KKZUB(`(`%.74S?#'Q.=4CG("!.5?_\1>T`%$AM__Q(&
  233. XM;(5:2'H`*DAZ#AXO"B\M`!!.N@4D3^\`&"0`2H)G!"`"8`0@+?_\3EU,WP0$8
  234. XM3G4@+P`$(&\`"$IH`#1L!C%``#1@`G#_3G5(YS\R)&\`,"9O`#1.50``+&T`F
  235. XM+'8`>`!@!%*M`"P@;0`L2A!G"B!M`"P,$``E9NJ][0`L9QXO"R`M`"R0CB\`2
  236. XM2'@``2\.3I)/[P`0)@!*@V\"V(,@;0`L4JT`+$H09@9P`&```>@@;0`L%!"T?
  237. XM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<Y2K0`D8!0@;0`H0^@`K
  269. XM!"M)`"@@;0`H+&C__'C_(&T`)`P0`#!E1B!M`"0,$``Y8CP@;0`D&A!X`&`F`
  270. XM,`1(P"(`<`I.NO/0$@5(@4C!DKP````PTH`X`5*M`"0@;0`D&A"Z/``P;0:ZF
  271. XM/``Y;\YV`"!M`"00$+`\`&AF"E*M`"0(PP`%8.JP/`!L9@I2K0`D",,`!F#:P
  272. XML#P`3&8.4JT`)`C#``=@RF`"8,8P!$C`+P`P`TC`+P`O"B\M`"PO#DAM__X@X
  273. XM;0`D4JT`)$*G'U```TZZ`$1/[P`<)`!*@F<"8`92DV``_L0,;?____YG$B\*A
  274. XM,"W__DC`+P`@;0`P3I!0CTJ"9PA*DV8$</]@`G``3EU,WTP\3G5(YSXR)&\`A
  275. XM+"9O`#`L;P`T-"\`/DY5_]@@;0`L-A!P`"M`__Q![?_<*TC_V&`(+PY.DUB/P
  276. XM-@"V?``@9_*V?``)9^RV?``*9^9*0F8&<`!@``*J2D-G!K9\__]F!G#_8``"3
  277. XMFA`M`"N0/`!%9P`"AE4`9P`"@)`\`!%G``&^D#P`"V=$4P!G``!Z4P!G``)F;
  278. XM4P!G``)@4P!G``):50!G``)46P!G``).4P!G``#24P!G``)"5P!G``%850!GS
  279. XM1%<`9P`!>&```BJT?/__9AQT`6`8(`IG`A2#+PY.DUB/-@`@"F<$1>H``5-"C
  280. XMMGS__V<``@2V?``*9P`!_$I"9M1@``'T>`!Z`+9\`"UG$K9\`#!M!K9\`#EO1
  281. XM!G#_8``!X+9\`"UF-'H!+PY.DUB/-@!30F`F(@1P"DZZ\<HB`"`!,@-(P=*`V
  282. XM*`&8O````#`O#DZ36(\B`#8!4T)*0F<,MGP`,&T&MGP`.6_*2D5G`D2$(@IGK
  283. XM``&")(1@``%\8``!>'@`>@"V?``M9Q*V?``P;0:V?``W;P9P_V```62V?``MQ
  284. XM9BYZ`2\.3I-8CS8`4T)@("($YX$@`3(#2,'2@"@!F+P````P+PY.DUB/(@`VH
  285. XM`5-"2D)G#+9\`#!M!K9\`#=OT$I%9P)$A"(*9P`!#"2$8``!!F```0)@&BH*2
  286. XM9P(4@R\.3I-8CRH`-@4J"F<$1>H``5-"2D)G&+9\`"!G$K9\``EG#+9\``IGU
  287. XM!K9\__]FRBH*9P``Q!2\``!@``"\>`!Z`#P"2,:V?``M9@``BGH!+PY.DUB/^
  288. XM-@!30F```'JV?``P;1RV?``Y;A8B!.F!(`$R`TC!TH`H`9B\````,&!*MGP`)
  289. XM86T>MGP`9FX8(`3I@"(`,`-(P-"!D+P```!A>`K8@&`FMGP`06TPMGP`1FXJR
  290. XM(@3I@2`!,@-(P=*`DKP```!!>`K8@6`"8!`O#DZ36(\B`#8!4T)*0F:$,@)(B
  291. XMP;R!9@1P_V`:2D5G`D2$(`IG""2$8`1P_F`((&T`+#"#<`!.74S?3'Q.=4YQ(
  292. XM(&\`!'``8`12B%*`2A!F^$YU3G$O"B!O``@B;P`,)$A@!A"`4HE2B!`12@!FB
  293. XM]!"\```@"B1?3G4O`DY5``!T`&`.,`)(P"\`3KH`$EB/4D*T;(`.;>Q.720?9
  294. XM3G5(YR`@3E4``'3_,"T`$DC`+P!.N@!46(\D0"`*9T!*J@`(9QA(>```2'@`A
  295. XM!2\2(&H`"$Z03^\`#"0`8!)T``@J``4`!F8(+Q).N@5N6(]P`"5```1P`"5`&
  296. XM``AP`"2`(`).74S?!`1.=2\","\`"C(`2,$T+(`.2,*T@6(*=`,I0H8^<`!@#
  297. XM(C0`2,+I@B)L@`K3PD'1""@`!``&9@IT`RE"ACYP`&`"(`@D'TYU+PI.50``V
  298. XM,"T`#DC`+P!.NO^L6(\D0"`*9S1*J@`(9QI(>```2'@``$AX``DO$B!J``A.,
  299. XMD$_O`!!@%B\23KH%2EB/2H!G!'`!8`9P`&`"</].721?3G5.<4CG."`D+P`8"
  300. XM)B\`'$Y5``!X_S`M`!I(P"\`3KK_2%B/)$`@"F=82JH`"&<6+P,O`DAX``0O+
  301. XM$B!J``A.D$_O`!!@/B`#4X`O`"\"+Q).N@2R3^\`#"@`2H1M)$J"9@BVO````
  302. XM``%G%$AX``!(>```+Q).N@2.3^\`#"@`(`1@`B`$3EU,WP0<3G5(YS`P)&\`.
  303. XM&"0O`!Q.50``=O].NN$\,"T`&DC`+P!.NOZ\6(\F0"`+9UAR"R`K``3`@6=(G
  304. XM2JL`"&<6+P(O"DAX``(O$R!K``A.D$_O`!!@-`@K``,`!V<22'@``4AX```OA
  305. XM$TZZ!!1/[P`,+P(O"B\33KH#ZD_O``PF`&`&<`0I0(8^(`-.74S?#`Q.=6$`*
  306. XM[@X@`4YU2.<`,B1O`!!.50``1^R%3B`*9@I(>```3KH$8EB/1>K_^&`6M<YF!
  307. XM$":6+RH`!"\*3KH$'E"/8!(F3BQ3(`YFY$AX``!.N@0V6(].74S?3`!.=4YQ5
  308. XM(&\`!")O``@@+P`,L\AG9F,``';1P-/`,@CBB65<,@GBB656L+P```$#92HBT
  309. XM`(+\`"QI(DCG/SX@/````"Q@"I'`3-!\_$CA/SY1R?_T2$$P`4S??/PR`.:(H
  310. XM8`0C(",@4<C_^I"\``$``&3P,`'`O`````=F!$YU$R!1R/_\D+P``0``9/).V
  311. XM=3((XHEE7#()XHEE5K"\```!`V4J(@""_``L:2)(YS\^(#P````L8`I,V'S\,
  312. XM2-%\_-/`4<G_]$A!,`%,WWS\,@#FB&`$(M@BV%'(__J0O``!``!D\#`!P+P`F
  313. XM```'9@1.=1+84<C__)"\``$``&3R3G5(YR`@)&\`#$Y5__P@"F<``)0(*@`"=
  314. XM`"=G``"*2FH`-&T6&VH`-?__-7S__P`T<``0+?__8```<$JJ`!QN5"\*3KH`L
  315. XM;EB/)`!*@F<$(`)@5DJJ`!QF/$AX``%(;?__+RH`,$ZZ`2A/[P`,)`!*@FX6F
  316. XM2H)F"`CJ``$`)V`&</\E0``H</]@(%*J`"QP`!`M__]@%%.J`!P@:@`,4JH`7
  317. XM#'``$!!@`G#_3EU,WP0$3G5.<4CG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A.KOZ,+%].=2\.+&R%1DYQ(F\`"$ZN_H8L7TYU+PXL;(5&!
  334. XM3G$@;P`(3J[^@"Q?3G4O#BQLA49.<2!O``A,[P(!``PB+P`43J[^1"Q?3G4`/
  335. XM`"\.+&R%1DYQ(F\`"$ZN_CXL7TYU+PXL;(5&3G$B;P`(3J[^."Q?3G5D;W,NJ
  336. XM;&EB<F%R>0````/L````!0````````"V````O````-P```#6```CZ`````(`:
  337. XM```!````;````$X````````#\@```^H```%1`````"H```````````,``#`Q]
  338. XM,C,T-38W.#E!0D-$148``````0``````!+8```2E```$D0``!(,```1T```$]
  339. XM90``!%4```1#```$,P``!"8```0;```$$0``!`$```/R```#Y0```]I.;W<@M
  340. XM<F5M;W9E('1H92!D:7-K(&%N9"!R96EN<V5R="!I="!B969O<F4@=7-I;F<N=
  341. XM"@!$96QE=&4@;V9F96YD:6YG(&9I;&4O<R!O<B!U<V4@+6X@;W!T:6]N("AD=
  342. XM86YG97)O=7,A*0H`4V]M92!D96%D('1R86-K<R!A<F4@86QL;V-A=&5D('1O&
  343. XM(&5X:7-T:6YG(&9I;&5S+@H`5F]L=6UE.B`E<RX@0FET;6%P(&]N("5D+@H`I
  344. XM17)R;W(@<F5A9&EN9R!R;V]T(&)L;V-K+B!1=6ET=&EN9RX*`$-H86YG92!I]
  345. XM="=S('!R;W1E8W1I;VX@86YD(&1E;&5T92!I="X@5&AE;B!R971R>0H`1FELP
  346. XM92`B+BXN1&5A9"(@86QR96%D>2!E>&ES=',@;VX@9')I=F4@9&8E,60Z+@H`0
  347. XM9&8Q.BXN+D1E860`("`@(&1F/SH@4V5T(&1R:79E(&YU;6)E<B`H9&5F875L8
  348. XM="!I<R!D<FEV92`Q*0H`("`@("UN(#H@06QL;W<@<F5A;&QO8V%T:6]N(&]F4
  349. XM(&)L;V-K<PH`("`@("UM(#H@36]D:69Y(&)I=&UA<"!O;FQY+B!$;VYT(&%DK
  350. XM9"!F:6QE"@!5<V%G93H@)7,@6RUM72!;+6Y=(%MD9C\Z72`*`#$S+S@O.3``B
  351. XM=C$N,C,`FS,S.S1M1&5A9"!T<F%C:R!A;&QO8V%T;W(@)7,NFS`[,S-M("D@#
  352. XM5&EM($UA8TME;GII92`E<RZ;,S%M"@!%<G)O<B!A;&QO8V%T:6YG(&)L;V-K0
  353. XM(&9O<B`N+BY$96%D(&9I;&4*``<N+BY$96%D`"$@1FEL92!F;W(@:&]L9&EN.
  354. XM9R!D96%D('1R86-K<R!I;BX`17)R;W(@86QL;V-A=&EN9R!B;&]C:R!F;W(@<
  355. XM+BXN1&5A9"!F:6QE"@`E8P!2971R>3\@`$5R<F]R('=R:71I;F<@8FET8FQO)
  356. XM8VLZ(`!4:&4@8FET;6%P(&)L;V-K(&AA<R!A;B!E<G)O<BXN+B!Q=6ET=&EN>
  357. XM9R`*`%=A<FYI;F<Z(&)L;V-K("5D(&ES(&%L;&]C871E9`H`0VAE8VL@8V]M!
  358. XM<&QE=&4N("5D(&5R<F]R<RX*`)L@<`!4<F%C:R`E9#H@`)M!`%1R86-K("5D#
  359. XM+@H`FS`@<`!%<G)O<B`E;&0Z("5S"@!0;W-T(%)E<V5T`$1R:79E(&EN('5SP
  360. XM90!"860@1')I=F4@5'EP90!"860@56YI="!.=6UB97(`3F\@365M;W)Y`%-EF
  361. XM96L@97)R;W(`1&ES:R!#:&%N9V5D`%=R:71E(%!R;W1E8W1E9`!"860@4V5C&
  362. XM=&]R($AE861E<@!4;V\@1F5W(%-E8W1O<G,`0F%D(%-E8W1O<B!S=6T`0F%D(
  363. XM($AE861E<B!S=6T`0F%D(%-E8W1O<B!)1`!"860@4V5C=&]R(%!R96%M8FQE!
  364. XM`$YO('-E8W1O<B!H96%D97(`3F]T(%-P96-I9FEE9`!T<F%C:V1I<VLN9&5V`
  365. XM:6-E`$-O=6QD;B=T(&]P96X@)7,N(&5X:71I;F<N"@!T<F%C:V1I<VLN9&5VF
  366. XM:6-E`$-A;G0@9V5T(#4Q,B!B>71E<R`H5VAA="!I<R!H87!P96YI;F<@=&\@K
  367. XM;7D@=V]R;&0_*0H`FR!PFS`[,S%M`````````^P````0`````0```&0```!@F
  368. XM````7````%@```!4````4````$P```!(````1````$`````\````.````#0`8
  369. X3```P````+````"@````````#\DP`%
  370. X``
  371. Xend
  372. Xsize 11224
  373. END_OF_FILE
  374. if test 15756 -ne `wc -c <'DeadAlloc.uu'`; then
  375.     echo shar: \"'DeadAlloc.uu'\" unpacked with wrong size!
  376. fi
  377. # end of 'DeadAlloc.uu'
  378. fi
  379. if test -f 'Deadalloc.c' -a "${1}" != "-c" ; then 
  380.   echo shar: Will not clobber existing file \"'Deadalloc.c'\"
  381. else
  382. echo shar: Extracting \"'Deadalloc.c'\" \(11087 characters\)
  383. sed "s/^X//" >'Deadalloc.c' <<'END_OF_FILE'
  384. X/*
  385. X *  deadalloc.c   Dead track allocator.
  386. X *  (c)Tim MacKenzie .
  387. X *
  388. X *  This program is freely redistributable. It may be modified, hacked and
  389. X *  mutilated as long as this is not for profit, this message must also
  390. X *  remain with it.
  391. X *
  392. X *  Begun:  17/6/90
  393. X *  History:
  394. X *              v1.0: Allocates dead blocks only.
  395. X *              v1.1: Creates file with dead blocks in it.
  396. X *              v1.2: Checks every block instead of just the first on a track
  397. X *              v1.21: Repaired some bugs in 1.2.
  398. X *              v1.22: Doesnt include blocks 0 and 1 in file list.
  399. X *                v1.23: Now doesn't write new bitmap if reallocating blocks.
  400. X */
  401. X
  402. X#define REV "v1.23"
  403. X#define DATE "13/8/90"
  404. X
  405. X#include <devices/trackdisk.h>
  406. X/* This should include lots of things with it (I hope) */
  407. X#include <exec/memory.h>
  408. X#include <stdio.h>
  409. X#include <ctype.h>
  410. X#include <proto/exec.h>
  411. X#include <proto/dos.h>
  412. X/* Works with DICE */
  413. X/* Need open_lib's with Aztec or Lattice */
  414. X
  415. Xstruct Task *my_task;
  416. Xstruct MsgPort port;
  417. Xstruct IOStdReq req;
  418. XUBYTE *m_data;  /* Sector buffer */
  419. Xchar drive=1; /* Which drive to access */
  420. Xchar error_list[160];
  421. Xlong bitblock;
  422. Xchar n_opt;
  423. Xchar doubly_alloc=0;
  424. X/* This flag gets set if a track is already allocated and is dead */
  425. X
  426. Xstruct file_head {
  427. X    long type;
  428. X    long key;
  429. X    long num_block;
  430. X    long dat_size;
  431. X    long first;
  432. X    long sum;
  433. X    long blocks[72];
  434. X    long res[2];
  435. X    long prot;
  436. X    long size;
  437. X    char comment[92];
  438. X    long date[3];
  439. X    char name[64];
  440. X    long hash;
  441. X    long parent;
  442. X    long extens;
  443. X    long sec;
  444. X} head;
  445. X
  446. Xclose_all()
  447. X{/* Closes anything that was opened in open_all()
  448. X  */
  449. X    printf("\x9b\x20\x70\x9b0;31\x6d");
  450. X     /* Back to normal */
  451. X    read_track(0);
  452. X    FreeMem(m_data,512);
  453. X    CloseDevice(&req);
  454. X    RemPort(&port);
  455. X    exit(0);
  456. X}
  457. X
  458. Xchkabort()
  459. X{/*  Dont let anyone take control away from me!*/
  460. X}
  461. X
  462. Xopen_all()
  463. X{/* This opens the trackdisk device and assoc stuff.
  464. X  */
  465. X    m_data=AllocMem(512,MEMF_CHIP);
  466. X    if (!m_data) {
  467. X        printf("Cant get 512 bytes (What is happening to my world?)\n");
  468. X        exit();
  469. X    }
  470. X    my_task=FindTask(0L);  /* Find my task! */
  471. X    port.mp_SigTask=my_task;
  472. X    AddPort(&port);
  473. X    if(OpenDevice(TD_NAME,(long)drive,&req,0L)) {
  474. X        printf("Couldn't open %s. exiting.\n",TD_NAME);
  475. X        exit();
  476. X    }
  477. X    req.io_Message.mn_ReplyPort=&port;
  478. X    req.io_Command=CMD_READ;
  479. X    req.io_Data=m_data;
  480. X    req.io_Length=TD_SECTOR;
  481. X}
  482. X
  483. X
  484. Xread_track(track)
  485. Xint track;
  486. X{/* Reads the track specified into the buffer.
  487. X  */
  488. X    int error;
  489. X    req.io_Command=CMD_READ;
  490. X    req.io_Length=TD_SECTOR;
  491. X    req.io_Offset= track *512;
  492. X    req.io_Data=m_data;
  493. X    error=DoIO(&req);
  494. X    req.io_Command=TD_MOTOR;
  495. X    req.io_Length=0;
  496. X    DoIO(&req); /* Turn motor off */
  497. X    return(error);
  498. X}
  499. X
  500. Xwrite_track(track)
  501. Xlong track;
  502. X{/* Writes the track specified into the buffer.
  503. X  */
  504. X    long error;
  505. X    req.io_Command=CMD_WRITE;
  506. X    req.io_Length=TD_SECTOR;
  507. X    req.io_Offset= track *512;
  508. X    req.io_Data=m_data;
  509. X    error=DoIO(&req);
  510. X    req.io_Command=TD_MOTOR;
  511. X    req.io_Length=0;
  512. X    DoIO(&req); /* Turn motor off */
  513. X    return(error);
  514. X}
  515. X
  516. Xdisplay_err(err)
  517. Xint err;
  518. X{/* Displays the error number and interpretation.
  519. X  */
  520. X    static char *msgs[]={
  521. X        "Not Specified",
  522. X        "No sector header",
  523. X        "Bad Sector Preamble",
  524. X        "Bad Sector ID",
  525. X        "Bad Header sum",
  526. X        "Bad Sector sum",
  527. X        "Too Few Sectors",
  528. X        "Bad Sector Header",
  529. X        "Write Protected",
  530. X        "Disk Changed",
  531. X        "Seek error",
  532. X        "No Memory",
  533. X        "Bad Unit Number",
  534. X        "Bad Drive Type",
  535. X        "Drive in use",
  536. X        "Post Reset"
  537. X    };
  538. X    printf("Error %ld: %s\n",err,msgs[err-20]);
  539. X}
  540. X
  541. Xcheck_disk()
  542. X{/* This routine checks the disk for errors and fills up the error_list array
  543. X  */
  544. X    long i;
  545. X    long err;
  546. X    int count;
  547. X    req.io_Command=CMD_READ;
  548. X    req.io_Length=512;
  549. X    count=0;
  550. X    printf("\x9b\x30\x20\x70");
  551. X    for (i=0;i<160;i++) {
  552. X        long j;
  553. X        printf("Track %d.\n",i);
  554. X        printf("\x9b\x41");
  555. X        for (j=0;j<11;j++) {
  556. X            req.io_Offset=(i*11 +j)*512;
  557. X            err=DoIO(&req);
  558. X            if (err) {
  559. X                printf("Track %d: ",i);
  560. X                display_err(err);
  561. X                error_list[i]=1;
  562. X                count++;
  563. X                break;
  564. X            }
  565. X        }
  566. X    }
  567. X    printf("\x9b\x20\x70");
  568. X    printf("Check complete. %d errors.\n",count);
  569. X    req.io_Command=TD_MOTOR;
  570. X    req.io_Length=0;
  571. X    DoIO(&req);
  572. X    return(count);
  573. X}
  574. X
  575. Xwarn(bit)
  576. Xint bit;
  577. X{
  578. X    ULONG *dat;
  579. X    ULONG block;
  580. X    long err;
  581. X    printf("Warning: block %d is allocated\n",bit);
  582. X     doubly_alloc=1;
  583. X}
  584. X
  585. X
  586. Xdead_alloc()
  587. X{/* This is the bit that allocates the dead blocks.
  588. X  */
  589. X    int i,j;
  590. X    ULONG sum;
  591. X    long bit,err;
  592. X    err=read_track(bitblock);
  593. X    if (err) {
  594. X        display_err(err);
  595. X        printf("The bitmap block has an error... quitting \n");
  596. X        return;
  597. X    }
  598. X    for (i=0;i<160;i++) {
  599. X        if (error_list[i]) {
  600. X            for (j=0;j<11;j++) {
  601. X               bit=32+ i*11 +j -2;
  602. X               if (bit>=32) {
  603. X                   if (!(((ULONG *)m_data)[bit/32] & (1<<(bit%32)))) warn(bit);
  604. X                   ((ULONG *)m_data)[bit/32] = (((ULONG *)m_data)[bit/32]) & ~((ULONG)1 << (bit%32));
  605. X                }
  606. X            }
  607. X        }
  608. X    }
  609. X    fix_bit_sum(m_data);
  610. X    do {
  611. X        err=write_track(bitblock);
  612. X        if (err) {
  613. X            char c;
  614. X            printf("Error writing bitblock: ");
  615. X            display_err(err);
  616. X            printf("Retry? ");
  617. X            fflush(stdout);
  618. X            scanf("%c",&c);
  619. X            if (!(c=='y' || c=='Y')) err=0;
  620. X        }
  621. X    } while (err);
  622. X}
  623. X
  624. Xfix_bit_sum(dat)
  625. XULONG *dat;
  626. X{
  627. X    ULONG sum,i;
  628. X    sum=0;
  629. X    for (i=1;i<128;i++)
  630. X        sum= sum+((ULONG *)dat)[i];
  631. X    ((ULONG *)dat)[0] = -sum;
  632. X}
  633. X
  634. Xfix_block_sum(dat)
  635. XULONG *dat;
  636. X{
  637. X    ULONG sum,i;
  638. X    sum=0;
  639. X    for (i=0;i<128;i++)
  640. X        if (i!=5)
  641. X            sum= sum+((ULONG *)dat)[i];
  642. X    ((ULONG *)dat)[5] = -sum;
  643. X}
  644. X
  645. Xlong
  646. Xfind_free()
  647. X{/* Finds a free block, allocates it and returns it's address.
  648. X  */
  649. X    long i,j,i1,j1;
  650. X    long err;
  651. X    err=read_track(bitblock);
  652. X    if (err) return(0);
  653. X    for (i1=880;i1<1760;i1++) {
  654. X        j1=1760-i1;
  655. X        i=i1+30;
  656. X        j=j1+30;
  657. X        if (((ULONG *)m_data)[i/32] & (1 << (i%32))) {
  658. X            ((ULONG *)m_data)[i/32] = (((ULONG *)m_data)[i/32]) & ~((ULONG)1 << (i%32));
  659. X            fix_bit_sum(m_data);
  660. X            write_track(bitblock);
  661. X            return(i1);
  662. X        }
  663. X        else if ((((ULONG *)m_data)[j/32] & (1 << (j%32))&&j>31)) {
  664. X            ((ULONG *)m_data)[j/32] = (((ULONG *)m_data)[j/32]) & ~((ULONG)1 << (j%32));
  665. X            fix_bit_sum(m_data);
  666. X            write_track(bitblock);
  667. X            return(j1);
  668. X        }
  669. X    }
  670. X}
  671. X
  672. Xdead_file(count)
  673. Xlong count;
  674. X{/* This creates the file "...dead" in the root directory of the disk
  675. X  * with the dead blocks in it.
  676. X  */
  677. X    long upto,err,which,howmany,next,i;
  678. X        int lower;
  679. X        if (error_list[0]==1) lower=2;
  680. X        else lower=0;
  681. X    if(!(which=find_free())) {
  682. X        printf("Error allocating block for ...Dead file\n");
  683. X        return;
  684. X    }
  685. X    head.type=2;
  686. X    head.key=which;
  687. X    head.prot=0x007;
  688. X    strcpy(head.comment,"\x21 File for holding dead tracks in.");
  689. X    strcpy(head.name,"\7...Dead");
  690. X    head.parent=880;
  691. X    head.sec=-3;
  692. X    for (upto=0,howmany=0;upto<1760 && howmany<72;upto++)
  693. X        if (error_list[upto/11] && upto>=2) {
  694. X            head.blocks[71-howmany]=upto;
  695. X            howmany++;
  696. X        }
  697. X    head.num_block=howmany-lower;
  698. X    head.size=(count*11-lower)*488;
  699. X    head.first=head.blocks[71];
  700. X    read_track(880);
  701. X    head.hash=((ULONG *)m_data)[61];
  702. X    ((ULONG *)m_data)[61]=which;
  703. X    /*                ^^  61 is the hash value for ...Dead . If you change
  704. X     *  the name then you have to change the hash value.
  705. X     */
  706. X    fix_block_sum(m_data);
  707. X    write_track(880);
  708. X    next=0;
  709. X    if (howmany==72) {
  710. X        if(!(next=find_free())) {
  711. X            printf("Error allocating block for ...Dead file\n");
  712. X            return;
  713. X        }
  714. X        head.extens=next;
  715. X    }
  716. X    for (i=0;i<128;i++)
  717. X        ((ULONG *)m_data)[i]=((ULONG *)&head)[i];
  718. X    fix_block_sum(m_data);
  719. X    write_track(which);
  720. X    /* Here make extension blocks if number of blocks > 72 */
  721. X    while (upto<1760) {
  722. X        long next_ext;
  723. X        next_ext=0;
  724. X        head.type=0x10;
  725. X        for (howmany=0;upto<1760 && howmany<72;upto++)
  726. X            if (error_list[upto/11]) {
  727. X                head.blocks[71-howmany]=upto;
  728. X                howmany++;
  729. X            }
  730. X        for (i=howmany;i<72;i++)
  731. X            head.blocks[71-i]=0;
  732. X        head.num_block=howmany;
  733. X        head.hash=0;
  734. X        for (i=0;i<92;i++) head.comment[i]=0;
  735. X        for (i=0;i<64;i++) head.name[i]=0;
  736. X        head.prot=0;
  737. X        head.size=0;
  738. X        head.parent=which;
  739. X        head.key=next;
  740. X        head.first=0;
  741. X        head.extens=0;
  742. X        if (howmany==72) {
  743. X            next_ext=find_free();
  744. X            head.extens=next_ext;
  745. X        }
  746. X        for (i=0;i<128;i++)
  747. X            ((ULONG *)m_data)[i]=((ULONG *)&head)[i];
  748. X        fix_block_sum(m_data);
  749. X        write_track(next);
  750. X        next=next_ext;
  751. X    }
  752. X}
  753. X
  754. Xmain(argc,argv)
  755. Xint argc;
  756. Xchar *argv[];
  757. X{
  758. X    BPTR in;
  759. X    int i,count;
  760. X    int err,nofile;
  761. X    nofile=0;
  762. X    printf("\x9b33;4mDead track allocator %s.\x9b0;33m ) Tim MacKenzie %s.\x9b31m\n",REV,DATE);
  763. X    for (i=1;i<argc;i++) {
  764. X        if (argv[i][0]!='-' && argv[i][0]!='d') {
  765. X            printf("Usage: %s [-m] [-n] [df?:] \n",argv[0]);
  766. X            printf("    -m : Modify bitmap only. Dont add file\n");
  767. X            printf("    -n : Allow reallocation of blocks\n");
  768. X            printf("    df?: Set drive number (default is drive 1)\n");
  769. X            exit(1);
  770. X        }
  771. X        if (argv[i][1]=='m') {nofile=1; continue;}
  772. X        if (argv[i][1]=='n') {n_opt=1; continue;}
  773. X        if (argv[i][1]=='f') {
  774. X            drive=argv[i][2]-'0';
  775. X            if (drive <0 || drive >4) {
  776. X                argv[i][0]='0';
  777. X                i--;
  778. X                continue;
  779. X            }
  780. X            continue;
  781. X        }
  782. X    }
  783. X    if (!nofile) {
  784. X        char name[12];
  785. X        strcpy(name,"df1:...Dead");
  786. X        name[2]='0'+drive;
  787. X        in = Open(name,MODE_OLDFILE);
  788. X        if (in) {
  789. X            printf("File \"...Dead\" already exists on drive df%1d:.\n",drive);
  790. X            printf("Change it's protection and delete it. Then retry\n");
  791. X            Close(in);
  792. X            exit();
  793. X        }
  794. X    }
  795. X    open_all();
  796. X    err=read_track(880);
  797. X    if(err) {
  798. X       display_err(err);
  799. X       printf("Error reading root block. Quitting.\n");
  800. X       close_all();
  801. X    }
  802. X    bitblock=((long *)m_data)[79];
  803. X    printf("Volume: %s. Bitmap on %d.\n",&m_data[(108<<2)+1],bitblock);
  804. X    count=check_disk();
  805. X    if (count) {
  806. X        dead_alloc();
  807. X        if (!n_opt && doubly_alloc) {
  808. X              printf("Some dead tracks are allocated to existing files.\n");
  809. X              printf("Delete offending file/s or use -n option (dangerous!)\n");
  810. X              close_all();
  811. X        }
  812. X        if (!nofile)
  813. X            dead_file(count);
  814. X        printf("Now remove the disk and reinsert it before using.\n");
  815. X    }
  816. X    close_all();
  817. X}
  818. END_OF_FILE
  819. if test 11087 -ne `wc -c <'Deadalloc.c'`; then
  820.     echo shar: \"'Deadalloc.c'\" unpacked with wrong size!
  821. fi
  822. # end of 'Deadalloc.c'
  823. fi
  824. echo shar: End of archive 1 \(of 1\).
  825. cp /dev/null ark1isdone
  826. MISSING=""
  827. for I in 1 ; do
  828.     if test ! -f ark${I}isdone ; then
  829.     MISSING="${MISSING} ${I}"
  830.     fi
  831. done
  832. if test "${MISSING}" = "" ; then
  833.     echo You have the archive.
  834.     rm -f ark[1-9]isdone
  835. else
  836.     echo You still need to unpack the following archives:
  837.     echo "        " ${MISSING}
  838. fi
  839. ##  End of shell archive.
  840. exit 0
  841. -- 
  842. Mail submissions (sources or binaries) to <amiga@uunet.uu.net>.
  843. Mail comments to the moderator at <amiga-request@uunet.uu.net>.
  844. Post requests for sources, and general discussion to comp.sys.amiga.
  845.